We can control the total length of the output text with this argument.

for example, to limit to 30 tokens long( remember not words or characters but tokens)

python code:

'''

from transformers import pipeline

generator = pipeline("text-generation", model="distilgpt2")
generator(
    "In this course, we will teach you how to",
    max_length=30,
    num_return_sequences=2,
)

'''